import { Component } from '@angular/core';
import {  NavController, NavParams,ViewController } from 'ionic-angular';
import { Brightness } from '@ionic-native/brightness';
/**
 * Generated class for the ChangelightPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */


@Component({
  selector: 'page-changelight',
  templateUrl: 'changelight.html',
})
export class ChangelightPage {
  public chooseType='handle';
  public singleValue=10;
  public pdfSrc='assets/myFile.pdf';
  public showArr=[
    {
      text:'1.ionic cordova plugin add cordova-plugin-brightness',
      tips:'安装cordova'
    },{
      text:' 2.npm install --save @ionic-native/brightness',
      tips:'安装依赖'
     },{
       text:"3.import { Brightness } from '@ionic-native/brightness';",
       tips:'添加到应用模块'
     }
  ]
  
  constructor(public navCtrl: NavController, 
     public viewCtrl:ViewController, 
     public navParams: NavParams,
    public  brightness: Brightness
    ) {
  }
  dismiss(){
    this.viewCtrl.dismiss();
  }
  setLight(){
    let brightnessValue = this.singleValue/100;
    this.brightness.setBrightness(brightnessValue);
  }
  segmentChanged(e){
    console.log(e);
    console.log(this.chooseType);
  }
  ionViewDidLoad() {
    console.log('ionViewDidLoad ChangelightPage');
  }

}
